package com.shanzmoo.h5.domain.vo;

import com.shanzmoo.db.product.entity.dto.ProductCategoryDTO;
import com.shanzmoo.db.product.entity.vo.CategoryVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;
import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@ApiModel("分类对象")
public class MallCategoryVO implements Serializable {
    private static final long serialVersionUID = 1758L;

    @ApiModelProperty("分类id")
    private Integer categoryId;

    @ApiModelProperty("分类名称")
    private String name;

    @ApiModelProperty(value = "分类图片")
    private String pictureUrl;

    @ApiModelProperty("子集分类")
    private List<MallCategoryVO> children;

    public static MallCategoryVO create(ProductCategoryDTO categoryVo) {
        return MallCategoryVO.builder()
                .categoryId(categoryVo.getId())
                .name(categoryVo.getName())
                .pictureUrl(categoryVo.getPictureUrl())
                .build();
    }
}
